Conventionally, a numerically controlled machine tool is arranged such that when a tool is about to move beyond a stroke end set by a limit switch of a machine tool or when the tool is about to enter a prohibited region of a stored stroke limit designated by a program or setting data, an error code is displayed as well as the tool is decelerated and stopped.
Nevertheless, according to this method, since the tool cannot stop at the stroke end if a sufficient distance necessary for deceleration and stopping is not set, a region in which machining can be carried out is set smaller than the size of a stroke. That is, there is a problem in that the region in which machining can be carried out is restricted smaller than a region set by an intrinsic stroke end of a machine tool.